#ifndef GAME_H
#define GAME_H

#include "Singleton.h"
#include "GameState.h"
#include "GameObject.h"
#include <map>
#include <string>

namespace Engine
{
	class Game : public NonCopyable
	{
		private:
			friend class Singleton <Game>;
			Game();

			typedef std::map <unsigned int, GameState*> GameStateMap;
			GameStateMap m_gameStates;
			GameState* m_currentGameState;
			bool m_gameRunning;

			std::string m_windowTitle;

			MapGameObject map_gobj;

		public:
			void UpdateGameObjects();
			void DrawGameObjects();
			void RegisterGameObject(GameObject* gobj);
			void UnregisterGameObject(unsigned int id);

			bool RegisterGameState(GameState* gs);
			bool Initialize(const std::string& fileName);
			void SetCurrentGameState(GameState* gs);
			void SetCurrentGameState(const std::string& name);

			void SetWindowTitle(const std::string& t);

			GameState* GetCurrentGameState() {return m_currentGameState;}
			const std::string& GetWindowTitle() const {return m_windowTitle;}

			void Start();
			bool GameIsRunning() const {return m_gameRunning;}
	};
	
	typedef Singleton <Game> TheGame;
}

#endif